package com.handshake.controller;

import com.handshake.entity.PartnersEntity;
import com.handshake.service.PartnersService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;


/**
 * 合作伙伴表
 *
 * @author LcLee Tankiland@outlook.com
 * @since 1.0.0 2024-10-09
 */
@RestController
@RequestMapping("partners")
@Tag(name="合作伙伴表")
public class PartnersController {
    @Autowired
    private PartnersService partnersService;
    @GetMapping("/{id}")
    public PartnersEntity getpartners(@PathVariable Long id) {
        return partnersService.getById(id);
    }
    //获取用户列表
    @GetMapping("/list")
    public List<PartnersEntity> listPartners() {
        return partnersService.list();
    }
    //新增用户
    @PostMapping("/add")
    public void addPartners(@RequestBody PartnersEntity partners) {
            partnersService.save(partners);
    }
    //更新用户
    @PutMapping("/update")
    public void updatePartners(@RequestBody PartnersEntity partners) {
            partnersService.updateById(partners);
    }
    //删除用户
    @DeleteMapping("/{id}")
    public void deletePartners(@PathVariable Long id) {
            partnersService.removeById(id);
    }

}
